package com.example.javatwo.controller.xs.dh;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.javatwo.pojo.xs.dh.DsdssaleMain;
import com.example.javatwo.service.xs.dh.IDsdssaleMainBiz;
import com.example.javatwo.util.PageBead;

@Controller
public class DsdssaleMainAction {

	@Autowired
	private IDsdssaleMainBiz biz;

	public IDsdssaleMainBiz getBiz() {
		return biz;
	}

	public void setBiz(IDsdssaleMainBiz biz) {
		this.biz = biz;
	}

	@RequestMapping("/findOne")
	@ResponseBody
	public DsdssaleMain findOne(String id) {
		return biz.findDsdssaleMain(id);
	}

	@RequestMapping("/save")
	@ResponseBody
	public String save(@RequestBody DsdssaleMain p) {
		int i = biz.saveDsdssaleMain(p);
		if (i == 1) {
			return "ok";
		} else {
			return "不能执行更新操作！";
		}
	}

	@RequestMapping("/loaddh")
	public String load() {
		return "xs/dh/DHtuihuo";
	}

	@RequestMapping("/findLoad")
	@ResponseBody
	public DsdssaleMain findMaxResult() {
		return biz.findMaxDateResult();
	}

	@RequestMapping("/findPageDh")
	@ResponseBody
	public PageBead findPageResult(Integer pageNum) {
		PageBead p = biz.findPageBead(pageNum);
		return p;
	}

	@RequestMapping("/delDsdssaleMain")
	@ResponseBody
	public String del(String id) {
		int i = biz.delDsdssaleMain(id);
		if (i == 1) {
			return "ok";
		} else {
			return "不能刪除已审核单据！";
		}
	}

	@RequestMapping("/shenheDsdss")
	@ResponseBody
	public String shenheClick(@RequestBody DsdssaleMain p) {
		int i = biz.shenheClick(p);
		if (i == 1) {
			return "ok";
		} else {
			return "不能重复审核！";
		}

	}

	@RequestMapping("/shenheCase")
	@ResponseBody
	public String shenheClickCase(@RequestBody DsdssaleMain p) {
		System.out.println(p);
		int i = biz.shenheCase(p);
		if (i == 1) {
			return "ok";
		} else {
			return "不能取消审核！";
		}

	}

}
